<!DOCTYPE html>
<html>
<head>
	<title>Generic Page w/ Service Worker scripts</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">

	<script type="text/javascript">
	document.cookie = "RT=\"\";domain=.boomerang-test.local;path=/";
	// BOOMR API Key is required for some multi-app versions of Boomerang
	window.BOOMR_API_key = "API_KEY";
	</script>

	<script src="../../../vendor/mocha/mocha.js"></script>
	<script src="../../../vendor/assertive-chai/dist/assertive-chai.js"></script>
	<script src="../../../vendor/lodash/lodash.js"></script>

	<script src="../../../build/boomerang-latest-debug.js" type="text/javascript"></script>
	<script src="../../../boomerang-test-framework.js" type="text/javascript"></script>

</head>
<body>
	<div id="output"></div>
	<script>
		// create a plugin that will run last
		BOOMR.plugins.ONUNLOADTEST = {
			init: function() {
				BOOMR.subscribe("before_unload", function() {
					BOOMR.addVar("onunloadtest", 1);
				});
			},
			is_complete: function() {
				return true;
			}
		};

		BOOMR_test.init({
			site_domain: "boomerang-test.local",
			ResourceTiming: {
				enabled: true
			}
		});
		document.getElementById("output").innerHTML = "Generic Page w/ Boomerang";
		document.getElementById("output").innerHTML += " " + document.location;
	</script>

	<script type="text/javascript">
		if ("serviceWorker" in navigator) {
			window.addEventListener("load", function() {
				navigator.serviceWorker.register("/pages/11-restiming/support/17-service-worker.js").then(function(registration) {
					// Registration was successful
					console.log("ServiceWorker registration successful with scope: ", registration.scope);
				}, function(err) {
					// registration failed :(
					console.log("ServiceWorker registration failed: ", err);
				});
			});
		}
	</script>

	<style>img, iframe { position: absolute; opacity: 0.5; }</style>

	<!-- 1x1 transparent pixel -->
	<img src="/pages/11-restiming/support/sm-image.jpg" style="top: 500px; left: 100px; width: 400px; height: 200px" />

	<!-- IFRAME -->
	<iframe src="/assets/blank.html" height="50" width="50" style="top: 800px; left: 200px; border: none"></iframe>

</body>
</html>
